<?php

		include	"sql_connect.php";
	
		// j'etablit la connection avc sql
		$bdd = sql_connect();
	
		$msg_erreur = "Erreur. Nous n'avons pas pu vous identifier. Verifier <br/><br/>";
		$msg_ok = "Bienvenue ";
		$message = $msg_erreur;
		
		$pre_req1 = 'mail, mdp';
		$pre_req2 = 'mail = :mail, mdp = :mdp';
		$req = $bdd->prepare('SELECT' . $pre_req1 . ' FROM users');// WHERE ' . $pre_req2) or die(print_r($bdd->errorInfo()));
		$req->execute(array(
			'mail' => $_POST['mail'],
			'mdp' => $_POST['mdp']
			));
		//$donnees = $req->fetch();			
		if (empty($_POST['mail']))
			$message .= "votre adresse electronique<br/>";
		if	(empty($_POST['mdp']))
			$message .= "votre nouveau mot de passe<br/>";
		if (strlen($message) > strlen($msg_erreur))
			echo $message;
		$req->closeCursor();
		// je ferme la connexion
		$bdd = null;
		/*if ($donnees != null)
			header('Location: index.php');*/
?>
